package com.HaFuManShu;

import java.io.IOException;
import java.util.Scanner;

public class HuffmanTree<T>{
    public Node[] ht;
    public String[] hc;
    public int n;

    public HuffmanTree(int n) {
        this.ht = new Node[2 * n - 1];
        this.hc = new String[n];
        this.n = n;
    }
    public void creatTree() throws IOException {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入n个字符和权值");
        int n= sc.nextInt();
        for (int i = 0; i < n; i++) {
            String ch=sc.next();
            double w= sc.nextDouble();
            ht[i]= new Node<>(ch, w, -1, -1, -1);
        }
    }
    //打印二叉树，打印哈夫曼编码
    //找到最小的权重
    public int selectMin(int n){
        int i,k;
        for (i = 0; i < n&&ht[i].getParent()!=-1; i++) {
               k=i;
//            for (int j = 0; j < ; j++) {
//
//            }
        }
        return 1;
    }
}
